from rest_framework.decorators import api_view

from libs.simple_responses import api_success
from datacenter.models.standard import STANDARD_MODELS


@api_view(['GET'])
def models(request):
    items = []
    for model in STANDARD_MODELS:
        item = {
            'value': model.value,
            'label': model.label,
            'fields': model.fields,
        }
        items.append(item)
    data = {
        'total': len(items),
        'items': items
    }
    return api_success(data=data)
